<template>
  <div id="app">
    <Header v-if="isShowHeader" />
    <router-view />
    <van-tabbar v-model="active">
      <van-tabbar-item icon="home-o" @click="goHome">主页</van-tabbar-item>

      <van-tabbar-item icon="setting-o" info="20" @click="goUser"
        >个人</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>

<script>
import Header from "@/components/Header";

export default {
  name: "App",
  components: {
    Header,
  },
  data() {
    return {
      active: 0,
    };
  },
  computed: {
    isShowHeader() {
      return this.$route.name !== "user";
    },
  },
  methods: {
    goHome() {
      console.log(this.$route);
      this.$router.push("/home").catch((e) => e);
    },
    goUser() {
      this.$router.push("/user").catch((e) => e);
    },
  },
};
</script>

<style>
</style>
